package coms;

import org.springframework.stereotype.Service;

// 标记为Spring服务类，交给IOC容器管理
@Service
public class OrderServiceImpl implements OrderService {

    @Override
    public void add(String pname, int number) {
        System.out.println("[业务] 购买 " + pname + "，数量：" + number);
    }

    @Override
    public void delete(String pname) {
        System.out.println("[业务] 删除购物车中的 " + pname);
    }

    @Override
    public int find(String pname) {
        int count = (int)(Math.random() * 10) + 1; // 模拟数量1-10
        System.out.println("[业务] 查询 " + pname + " 的数量");
        return count;
    }
}
